package com.itheima.response;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/demo03")
public class ResponseDemo03Servlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          //地址栏访问 通过get请求进行处理
        System.out.println("请求来了，我response对象设置状态码");
       // 正常访问到我们servlet 状态码是200
        // 我们可以手动更改状态码
//        response.setStatus(500);
        response.setStatus(404);//页面找不到  防盗链的时候


    }
}
